home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / MELL / NETLIB00 / !NetLib / arpa / h / inet next >
Encoding:
Text File  |  1996-06-27  |  3.0 KB  |  93 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that: (1) source distributions retain this entire copyright
  7.  * notice and comment, and (2) distributions including binaries display
  8.  * the following acknowledgement:  ``This product includes software
  9.  * developed by the University of California, Berkeley and its contributors''
  10.  * in the documentation or other materials provided with the distribution
  11.  * and in all advertising materials mentioning features or use of this
  12.  * software. Neither the name of the University nor the names of its
  13.  * contributors may be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *    @(#)inet.h    5.4 (Berkeley) 6/1/90
  20.  */
  21.  
  22. #ifndef __arpa_inet_h
  23. #define __arpa_inet_h
  24.  
  25. /* Freenet programmers interface - arpa/inet.h - edited by andy 23/5/95 */
  26. /* BIND-4.9.4 changes edited in by stewart 27/6/96 */
  27.  
  28. #include <stddef.h>
  29. #include "netinet/in.h"
  30. #include "sys/types.h"
  31.  
  32. /*
  33.  * Check whether "cp" is a valid ascii representation
  34.  * of an Internet address and convert to a binary address.
  35.  * Returns 1 if the address is valid, 0 if not.
  36.  * This replaces inet_addr, the return value from which
  37.  * cannot distinguish between failure and a local broadcast address.
  38.  */
  39.  
  40. extern u_long inet_aton(const char * /*cp*/, struct in_addr * /*addr*/);
  41.  
  42. /*
  43.  * Convert string containing 'dotted' address into numeric
  44.  * internet address
  45.  */
  46. extern u_long inet_addr(const char */*cp*/);
  47.  
  48. /*
  49.  * Convert string containing 'dotted' address into numeric
  50.  * internet network number
  51.  */
  52. extern u_long inet_network(const char */*cp*/);
  53.  
  54. /*
  55.  * Forms an internet address from a network number and a
  56.  * local network address
  57.  */
  58. extern struct in_addr inet_makeaddr(u_long /*net*/,u_long /*lna*/);
  59.  
  60. /*
  61.  * Extract the local network address from an internet address
  62.  */
  63. extern u_long inet_lnaof(struct in_addr /*in*/);
  64.  
  65. /*
  66.  * Extract the network number from an internet address
  67.  */
  68. extern u_long inet_netof(struct in_addr /*in*/);
  69.  
  70. /*
  71.  * Format an internet address in string form
  72.  */
  73. extern char *inet_ntoa(struct in_addr /*in*/);
  74.  
  75. /*
  76.  * Check whether "src" is a valid ascii representation
  77.  * of an Internet address and convert to a binary address.
  78.  * This replaces inet_addr, the return value from which
  79.  * cannot distinguish between failure and a local broadcast address.
  80.  * return:
  81.  *    1 if the address was valid for the specified address family
  82.  *    0 if the address wasn't valid (`dst' is untouched in this case)
  83.  *    -1 if some other error occurred (`dst' is untouched in this case, too)
  84. */
  85. extern int inet_pton (int /*af*/, const char */*src*/, void */*dst*/);
  86.  
  87. /*
  88.  * Format an internet address in presentation (ASCII string) form
  89.  */
  90. extern const char *inet_ntop (int /*af*/, const void */*src*/, char */*dst*/, size_t /*s*/);
  91.  
  92. #endif
  93.